﻿
var Usernamestorage = function () {
    if (!localStorage)
        return;
    var self = this;
    
    self.set = function (value) {
        //must be an array of strings
        var stringified = JSON.stringify(value);
        localStorage.setItem('usernamehistory', stringified);
    };    
    self.get = function () {
        var storedusers = localStorage.getItem('usernamehistory');
        if (!storedusers) {
            storedusers = []; //empty json array

            self.set(storedusers);
        }
        return ko.utils.parseJson(storedusers);
    };
};


